<template>
  <div
    class="page-container"
    :style="{
      backgroundColor: config.bgColor || '#ffffff',
      backgroundImage: `url(${config.bgUrl})`,
      height: px2rpx2px(config.bgImgHeight),
    }"
  >
    <slot></slot>
    <!--  加载  -->
  </div>
</template>

<script>
const defaultConfig = () => ({
  bgColor: "white",
  bgUrl: "",
  bgImgHeight: "728px",
});
</script>
<script setup>
import { defineProps } from "vue";
import { px2rpx2px } from "../utils/index";

defineProps({
  config: {
    type: Object,
    default: () => defaultConfig(),
  },
});
</script>

<style lang="scss" scoped>
.page-container {
  width: 100%;
  flex: 1;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
}
</style>
